﻿<div ng-controller="listCtrl" ng-init='initialListResponse = @Html.Raw(Json.Encode(Model))'>
    @Html.Partial("_Filter")
    <button id="Add" class="btn btn-primary" type="button" ng-click="add()">@T("Common.Add")</button>
    <table class="table table-striped table-hover ">
        <thead>
            <tr sort-header default-sort="sorting" sort-action="sortBy(sorting)">
                <th scope="col" sort-column="Id" header='@T("Policy.Fields.Id")'></th>
                <th scope="col" sort-column="Number" header='@T("Policy.Fields.Number")'></th>
                <th scope="col">@T("Policy.Fields.PersonName")</th>
                <th scope="col">@T("Policy.Fields.State")</th>
                <th scope="col">@T("Policy.Fields.TypeOfFuel")</th>
                <th scope="col">
                </th>
                <th scope="col">
                </th>
                <th scope="col">
                </th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="item in list">
                <td ng-bind="item.Id"></td>
                <td ng-bind="item.Number"></td>
                <td ng-bind="item.Person.Name"></td>
                <td>{{item.StateID | dictionary : 'ApprovalStates'}}</td>
                <td>{{item.TypeOfFuelID | dictionary : 'TypesOfFuels'}}</td>
                <td> <button ng-click="edit($index)" class="btn btn-default">@T("Common.Edit")</button></td>
                <td> <button ng-click="remove($index)" class="btn btn-default">@T("Common.Delete")</button></td>
                <td> <a class="btn btn-small" href="api/policies/{{item.Id}}/document">PDF <span class="glyphicon glyphicon-export"></span></a></td>
            </tr>
        </tbody>
    </table>
    <pagination total-items="itemsCount" ng-model="paging.currentPage" max-size="paging.linksSize" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages" items-per-page="paging.pageSize" ng-change="pageChanged()"></pagination>
    @Html.Partial("_Edit")
</div>